home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / Utility Functions / NewTextFuncs-1 / README.NewTextFuncs < prev   
Encoding:
Text File  |  1994-07-07  |  2.5 KB  |  72 lines  |  [TEXT/R*ch]

  1. NewText
  2. by Maurice Sharp, J. Christopher Bell
  3. Copyright 1994 by Apple Computer, Inc. All rights reserved
  4.  
  5. This sample demonstrates two new text calls that are available in ROMs with
  6. versions greater or equal to 1.3 (the MessagePad 110 and later). You should
  7. really test for these functions before you use them. If you need to do
  8. something like wrapping text, you could default to the method use in the Wrap
  9. It Up sample code. A way to test things...
  10.  
  11.     if functions.TextBox exists then
  12.         TextBox(...)
  13.     else
  14.         MyFunkyTextBoxBasedOnWrapItUp(...)
  15.     
  16.  
  17. Note that the actual drawing is done within a DoDrawing() dispatch, which is the
  18. correct way to set up your drawing outside of a viewDrawScript. If you do not
  19. do your drawing with a normal viewDrawScript or the DoDrawing function,
  20. the clipping region will be incorrect. Symptoms of bad clipping are overwriting
  21. the extras drawer, keyboards, the styles pallete, or other views overlapping 
  22. with your view. If you do your drawing this way, you will not have these problems.
  23.     
  24.     
  25.  
  26. The functions are:
  27.  
  28. // *** TextBox
  29. TextBox(<text>, <funkyFontFrame>, <bounds>)
  30. return value - undefined
  31. text - string to draw
  32. funkyFontFrame - see funkyFontFrame description below 
  33. bounds - bounds frame to draw into
  34.  
  35. This function wraps text so that it fits in bounds and blasts it onto the
  36. screen use this in a viewDrawScript Note: the bounds are in local coordinates
  37. of the view that makes the TextBox call.
  38.  
  39.  
  40.  
  41. // *** TextBounds
  42. TextBounds(<text>, <funkyFontFrame>, <bounds>)
  43. return value - undefined
  44. text - the text to 'wrap'
  45. funkyFontFrame - see funkyFontFrame description below (justification is ignored)
  46. bounds - bounds frame with width or height 0. The bounds object
  47. itself will be modified. This frame should not be a read-only
  48. object
  49.  
  50. TextBounds returns bounds that <text> would wrap to based on certain 
  51. conditions. For this to  work, either width or height or both must be 0. 
  52. IMPORTANT: the original bounds frame is actually modified. 
  53.  
  54. If one of width or height are 0, the bounds returned reflects
  55. wrapping the text to fit the constrained dimension
  56.  
  57. If both width and height are 0, the bounds returned just use
  58. explicit CR's in the text to find the bounds
  59.  
  60.  
  61.  
  62. // *** About funkyFontFrame
  63. funkyFontFrame objects
  64.  
  65. This frame contains both a font specification and, optionally,
  66. a justification, the format is:
  67.  
  68. {font: <font-frame>, justification: <justify-symbol>}
  69. <font-frame>: must be a font frame as per NPG (NOT a condensed number)
  70. <justify-symbol>: ['left|'center|'right]
  71.                   if slot not present or slot is nil, defaults to 'left
  72.